package netty;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufAllocator;

public class TestSlice {
    public static void main(String[] args) {
        ByteBuf buf = ByteBufAllocator.DEFAULT.buffer(10);
        buf.writeBytes(new byte[]{'a','b','c','d','e'});

        ByteBuf buf1 = buf.slice(0, 2);
        ByteBuf buf2 = buf.slice(1, 4);
        System.out.println(buf1);
        System.out.println(buf2);
        buf.release();
        System.out.println(buf1);

    }
}
